<template>
	<view class="box">
		<view class="title">
			提现金额
		</view>
		<view class="listbox">
			<view :class="index==current?'annius':'anniu'" v-for="(item,index) in list" :key="index" @click="select(index,item)">
				{{item}}
			</view>
		</view>
		<view class="tx" @click="withdraw">
			提现
		</view>
	</view>
</template>

<script>
	import {getmoneylist,userwithdrawal} from "../../api/api/index.js"
	export default{
		data(){
			return{
				list:[],
				current:0,
				money:0
			}
		},
		methods:{
			select(v,i){
				this.current=v
				this.money=i
			},
			withdraw(){
				uni.showLoading({
					title:"加载中",
					mask:true
				})
				userwithdrawal({money:this.money}).then(res=>{
					uni.hideLoading()
					uni.showToast({
						title:res.data,
						icon:"none",
						duration:1000
					})
				})
			}
		},
		onShow() {
			getmoneylist().then(res=>{
				this.list=res.data
				this.money=res.data[0]
			})
		}
	}
</script>

<style scoped lang="scss">
	.box{
		position:fixed;
		top: 0;
		bottom: 0;
		right: 0;
		left: 0;
		background-color: #FFFFFF;
		padding: 20rpx;
		box-sizing: border-box;
		overflow: scroll;
		.title{
			font-size: 30rpx;
			font-family: Microsoft YaHei;
			font-weight: bold;
			color: #000000;
		}
		.listbox{
			display: flex;
			flex-wrap: wrap;
			margin-top: 20rpx;
			.anniu{
				width: 201rpx;
				height: 82rpx;
				border-radius: 82rpx;
				line-height: 82rpx;
				text-align: center;
				border: 1rpx solid #CCCCCC;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #000000;
				margin-right: 38rpx;
				margin-bottom: 60rpx;
			}
			.annius{
				width: 201rpx;
				height: 82rpx;
				border-radius: 82rpx;
				line-height: 82rpx;
				text-align: center;
				border: 1rpx solid #CC3C3C;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #CC3333;
				margin-right: 38rpx;
				margin-bottom: 60rpx;
			}
		}
	}
	.tx{
		width: 527rpx;
		height: 90rpx;
		text-align: center;
		line-height: 90rpx;
		border-radius: 90rpx;
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		margin:100rpx auto ;
		background-color: #CC3333;
	}
</style>
